STEP 6: Now let's learn about how we control specific parts of the commands in our program.
A parameter is a value in a command that controls how the command runs. One parameter is the string that you just changed. The other parameters control the placement and the color of the text. Use can use the comment as a guide.
Change the x coordinate to 0 and the y coordinate to -200. Change the color to "blue".
To navigate the page using the TAB key, first press ESC to exit the code editor.
stage.set_background("park")
sprite = codesters.Sprite("person3")
sprite.glide_to(-100, 50)
# sprite = codesters.Text("text", x, y, "color")
text = codesters.Text("I went to the park!", 100, 200, "red")
t = codesters.Teacher()
txt_func = t.get_parameters_for_function('Text')
try:
tval2 = int(txt_func[0][1])
except:
tval2 = "DNE"
try:
tval3 = int(txt_func[0][2])
except:
tval3 = "DNE"
try:
tval4 = txt_func[0][3]
except:
tval4 = "DNE"
t1 = TestObjective()
t1.add_success(tval2 == 0 and tval3 == -200, "Great job!")
t1.add_failure(tval2 == "DNE", "Oops! Did you delete the Text in Color command?")
t1.add_failure(tval3 == "DNE", "Oops! Did you delete the Text in Color command?")
t1.add_failure(tval2 == 100, "Did you change the x coordinate?")
t1.add_failure(tval3 == 200, "Did you change the y-coordinate?")
t1.add_creative(tval2 != 0 and tval2 != 100 and tval2 != "DNE", "That's a good place for text, too!")
t1.add_creative(tval3 != -200 and tval3 != 200 and tval3 != "DNE", "That's a good pace for text, too!")
t2 = TestObjective()
t2.add_success("blue" in tval4, "Great job!")
t2.add_failure(tval4 == "DNE", "Oops! Did you delete the Text in Color command?")
t2.add_failure('red' in tval4, "Did you change the text color?")
t2.add_creative('blue' not in tval4 and 'red' not in tval4 and tval4 != "DNE", "That's a good color, too!")
tester = TestManager()
tester.add_test_list([t1, t2])
tester.run_tests()
tester.display_first_feedback()
Are you already running a Codesters project in another tab or window?
Micro:bit can only connect to one web page at a time.
Try stopping other Codesters projects or closing
other tabs or windows that may be using your Micro:bit.
If that doesn't fix the problem try disconnecting your Micro:bit,
reloading this page, and reconnecting your Micro:bit.